export default function throttle(event, time) {
    let pre = 0;
    let timer = null;
    return function (...args) {
      if (Date.now() - pre > time) {
        clearTimeout(timer);
        timer = null;
        pre = Date.now();
        event.apply(this, args);
      } else if (!timer) {
        timer = setTimeout(() => {
          event.apply(this, args);
        }, time);
      }
    }
  }